<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML LANG="EN-US">
<HEAD>
<TITLE>VT100.net: VT330/VT340 Programmer Reference Manual</TITLE>
<LINK HREF="vt330.css" TYPE="text/css" REL="stylesheet">
</HEAD>
<BODY>
<DIV CLASS="navbar"><A HREF="http://vt100.net/"><IMG CLASS="button" SRC="vt100.net-logo.png" ALT="VT100.net" HEIGHT="16" WIDTH="102"></A> VT330/VT340 Programmer Reference Manual Volume 2: Graphics Programming<TABLE WIDTH="100%">
<COL SPAN="3" WIDTH="33%">
<TBODY>
<TR>
<TD ALIGN="LEFT"><A HREF="chapter13.html">Chapter 13</A></TD>
<TD ALIGN="CENTER"><A HREF="contents.html">Contents</A></TD>
<TD ALIGN="RIGHT"><A HREF="chapter15.html">Chapter 15</A></TD>
</TR>
</TBODY>
</TABLE>
<HR></DIV>
<H1 ID="S14"><SPAN CLASS="chapnum">14</SPAN> Sixel Graphics</H1>
<H2 ID="S14.1">What are Sixels?</H2>
<P>The VT300 can send and receive sixel graphics data. You can draw monochrome
or color (VT340 only) images with sixel data.</P>
<P>A <DFN>sixel</DFN> is a group of six pixels in a vertical column. A pixel (picture element) is
the smallest displayable unit on a video screen. Sixels represent bitmap data
for a graphic image. The terminal processes sixel data as bits of information. A
bit value of 1 means turn on a pixel. A bit value of 0 means turn off the pixel.</P>
<P>You use a single character code for each sixel. The terminal uses 6 bits of the
8-bit character code to encode bitmap data.</P>
<P>You can use sixels to design character sets and fonts for display. Volume 1,
Chapter 5 of this manual describes how to design and load soft character sets
into the terminal.</P>
<H2 ID="S14.2">Sixel Data Format</H2>
<P>The VT300 uses a device control string to send and receive sixel images.</P>
<P CLASS="note">NOTE: See Volume 1, Chapter 2 of this manual for general information about
device control strings.</P>
<P>Many of Digital's printers recognize the control string format. Here are some
examples.</P>
<UL>
<LI>LA12</LI>
<LI>LA50</LI>
<LI>LA100</LI>
<LI>LA34-VA</LI>
<LI>LN03</LI>
</UL>
<P>Different printers have different output quality. For example, dot matrix printers
are very different from laser printers. When you design sixel images on the
terminal for printing, you should use parameter values that are appropriate for
your printer. For more information, see your printer's programmer reference
manual.</P>
<H3 ID="S14.2.1">Device Control String</H3>
<P>The format for the device control string is as follows.</P>
<DIV CLASS="example"><TABLE CLASS="codeseq">
<TBODY>
<TR>
<TH>DCS</TH>
<TH>P1</TH>
<TH>;</TH>
<TH>P2;</TH>
<TH>P3;</TH>
<TH>q</TH>
<TH>s..s</TH>
<TH>ST</TH>
</TR>
<TR>
<TD>9/0</TD>
<TD>**</TD>
<TD>3/11</TD>
<TD>**</TD>
<TD>**</TD>
<TD>7/1</TD>
<TD>***</TD>
<TD>9/12</TD>
</TR>
</TBODY>
</TABLE></DIV>
<P>where</P>
<DIV CLASS="example"><P><B>DCS</B> is a C1 control character that introduces the sixel data sequence.
You can also express DCS as the 7-bit escape sequence ESC P for a 7-bit
environment.</P>
<P><B>P1</B> is the macro parameter. This parameter indicates the pixel aspect ratio
used by the application or terminal. The pixel aspect ratio defines the
shape of the pixel dots the terminal uses to draw images. For example, a
pixel that is twice as high as it is wide has as aspect ratio of 2:1. The
following list shows the values you can use for P1.</P>
<P CLASS="note">NOTE: The macro parameter is provided for compatibility with existing
Digital software. New applications should set P1 to 0 and use the set raster
attributes control, described later in this chapter.</P>
<TABLE CLASS="dpadded">
<THEAD>
<TR VALIGN="BOTTOM">
<TH>P1</TH>
<TH>Pixel Aspect Ratio<BR>(Vertical:Horizontal)</TH>
</TR>
</THEAD>
<TBODY>
<TR>
<TD><STRONG>Omitted</STRONG></TD>
<TD><STRONG>2:1</STRONG> (default)</TD>
</TR>
<TR>
<TD>0, 1</TD>
<TD>2:1</TD>
</TR>
<TR>
<TD>2</TD>
<TD>5:1</TD>
</TR>
<TR>
<TD>3, 4</TD>
<TD>3:1</TD>
</TR>
<TR>
<TD>5, 6</TD>
<TD>2:1</TD>
</TR>
<TR>
<TD>7, 8, 9</TD>
<TD>1:1</TD>
</TR>
</TBODY>
</TABLE>
<P>You can override the setting of the macro parameter by using the set raster
attributes character (", 2/2) in a sixel data string. See below.</P>
<P><B>;</B> is a semicolon (3/11). This character separates numeric parameters in a
DCS string.</P>
<P><B>P2</B> selects how the terminal draws the background color. You can use one
of three values.</P>
<TABLE CLASS="dpadded">
<THEAD>
<TR VALIGN="BOTTOM">
<TH>P2</TH>
<TH>Meaning</TH>
</TR>
</THEAD>
<TBODY>
<TR VALIGN="TOP">
<TD><STRONG>0</STRONG> or 2 (default)</TD>
<TD>Pixel positions specified as 0 are set to the current background color.</TD>
</TR>
<TR VALIGN="TOP">
<TD>1</TD>
<TD>Pixel positions specified as 0 remain at their current color.</TD>
</TR>
</TBODY>
</TABLE>
<P><B>P3</B> is the horizontal grid size parameter. The horizontal grid size is the
horizontal distance between two pixel dots. The VT300 ignores this parameter
because the horizontal grid size is fixed at 0.0195 cm (0.0075 in).</P>
<P><B>q</B> indicates that this device control string is a sixel command.</P>
<P><B>s...s</B> is the sixel-encoded data string. The <DFN>sixel data characters</DFN> are characters
in the range of ? (hex 3F) to ~ (hex 7E). Each sixel data character
represents six vertical pixels of data. Each sixel data character represents
a binary value equal to the character code value minus hex 3F.</P>
<P><STRONG>Examples</STRONG></P>
<UL>
<LI>? (hex 3F) represents the binary value 000000.</LI>
<LI>t (hex 74) represents the binary value 110101.</LI>
<LI>~ (hex 7E) represents the binary value 111111.</LI>
</UL>
<P>The terminal translates the six bits to a <EM>sixel</EM> &#8211; six pixels in a vertical
column. The least significant bit is at the top.</P>
<P CLASS="note">NOTE: For information on how to code sixel characters, see "Soft Character
Sets" in Volume 1, Chapter 5 of this manual.</P>
<P>You can also use sixel control functions in the data string. The next section
describes these characters and their functions.</P>
<P><B>ST</B> is the string terminator. ST is a C1 control character. You can also
express ST as the 7-bit escape sequence ESC \ for a 7-bit environment.</P></DIV>
<H2 ID="S14.3">Sixel Control Functions</H2>
<P>You can use sixel control functions to perform special functions, such as selecting
colors and raster attributes.</P>
<H3 ID="S14.3.1">Graphics Repeat Introducer (!)</H3>
<P>The ! (2/1) character introduces a repeat sequence. A repeat sequence lets you
repeat a graphic character a specified number of times. You use the following
format for the repeat sequence.</P>
<DIV CLASS="example"><TABLE CLASS="codeseq">
<TBODY>
<TR>
<TH>!</TH>
<TH>Pn</TH>
<TH>character</TH>
</TR>
<TR>
<TD>2/1</TD>
<TD>**</TD>
<TD>****</TD>
</TR>
</TBODY>
</TABLE></DIV>
<P>where</P>
<DIV CLASS="example"><P><B>Pn</B> is the repeat count. The repeat count can be any decimal value. For
example, if you use a repeat count of 23, the next character repeats 23
times.</P>
<P><B>character</B> is the character to repeat. You can use any character in the
range of ? (hex 3F) to ~ (hex 7E).</P></DIV>
<H3 ID="S14.3.2">Raster Attributes (")</H3>
<P>The " (2/2) character is the set raster attributes command. This command selects
the raster attributes for the sixel data string that follows it. You must use
the command before any sixel data string. The " command overrides any raster
attributes set by the macro parameter described above. You use the following
format for the " command.</P>
<DIV CLASS="example"><TABLE CLASS="codeseq">
<TBODY>
<TR>
<TH>"</TH>
<TH>Pan</TH>
<TH>;</TH>
<TH>Pad;</TH>
<TH>Ph;</TH>
<TH>Pv</TH>
</TR>
<TR>
<TD>2/2</TD>
<TD>**</TD>
<TD>3/11</TD>
<TD>**</TD>
<TD>**</TD>
<TD>**</TD>
</TR>
</TBODY>
</TABLE></DIV>
<P>where</P>
<DIV CLASS="example"><P><B>Pan</B> and <B>Pad</B> define the pixel aspect ratio for the following sixel data
string. Pan is the numerator, and Pad is the denominator.</P>
<PRE>Pan
--- = pixel aspect ratio
Pad</PRE>
<P>The pixel aspect ratio defines the shape of the pixels the terminal uses to
draw the sixel image.</P>
<P>Pan defines the vertical shape of the pixel. Pad defines the horizontal
shape of the pixel. For example, to define a pixel that is twice as high as
it is wide, you use a value of 2 for Pan and 1 for Pad.</P>
<P>If you use the set raster attributes command (") in a sixel data string, you
must specify a pixel aspect ratio. You can only use integer values for Pan
and Pad. The VT300 rounds the pixel aspect ratio to the nearest integer.</P>
<P><B>Ph</B> and <B>Pv</B> define the horizontal and vertical size of the image (in pixels),
respectively.</P>
<P>Ph and Pv do <EM>not</EM> limit the size of the image defined by the sixel data.
However, Ph and Pv let you omit background sixel data from the image
definition and still have a color background. They also provide a concise
way for the application or terminal to encode the size of an image.</P>
<P CLASS="note">NOTE: The VT300 uses Ph and Pv to erase the background when P2 is
set to 0 or 2.</P></DIV>
<H3 ID="S14.3.3">Color Introducer (#)</H3>
<P>The # (2/3) color introducer starts a color selection sequence. There are two
ways to select colors.</P>
<UL>
<LI>Select a color map entry by number.</LI>
<LI>Use HLS (hue, lightness, and saturation) or RGB (red, green, blue) colors.</LI>
</UL>
<H3 ID="S14.3.3.1">Basic Colors</H3>
<P>You can use the following format to select a basic color map entry.</P>
<DIV CLASS="example"><TABLE CLASS="codeseq">
<TBODY>
<TR>
<TH>#</TH>
<TH>Pc</TH>
</TR>
<TR>
<TD>2/3</TD>
<TD>**</TD>
</TR>
</TBODY>
</TABLE></DIV>
<P>where</P>
<DIV CLASS="example"><P><B>Pc</B> is the color number (<A HREF="#T14-1">Table 14-1</A>).</P></DIV>
<P CLASS="note">NOTE: The VT330 has 4 available color map entries, the VT340 has 16.</P>
<H3 ID="S14.3.3.2">HLS or RGB Colors</H3>
<P>You use the following format to specify HLS or RGB
colors. HLS and RGB are universally recognized color coordinate systems.</P>
<DIV CLASS="example"><TABLE CLASS="codeseq">
<TBODY>
<TR>
<TH>#</TH>
<TH>Pc</TH>
<TH>;</TH>
<TH>Pu;</TH>
<TH>Px;</TH>
<TH>Py;</TH>
<TH>Pz</TH>
</TR>
<TR>
<TD>2/3</TD>
<TD>**</TD>
<TD>3/11</TD>
<TD>**</TD>
<TD>**</TD>
<TD>**</TD>
<TD>**</TD>
</TR>
</TBODY>
</TABLE></DIV>
<P>where</P>
<DIV CLASS="example"><P><B>Pc</B> is the color number.</P>
<P><B>Pu</B> is the color coordinate system (HLS or RGB).</P>
<P><B>Px</B>, <B>Py</B>, and <B>Pz</B> are the color coordinates in the specified system. <A HREF="#T14-1">Table
14-1</A> lists the possible values.</P></DIV>
<TABLE ID="T14-1" CLASS="majortable">
<CAPTION>Table 14-1 Color Specifier</CAPTION>
<THEAD>
<TR>
<TH>Parameter</TH>
<TH>Possible Values</TH>
<TH>Definition</TH>
</TR>
</THEAD>
<TBODY>
<TR VALIGN="TOP">
<TD>Pc</TD>
<TD>0 to 255</TD>
<TD>The color number to define.</TD>
</TR>
<TR VALIGN="TOP">
<TD>Pu (required)</TD>
<TD>1<BR>2</TD>
<TD>HLS (hue, lightness, and saturation)<BR>RGB (red, green, and blue)</TD>
</TR>
<TR VALIGN="TOP">
<TD COLSPAN="3"><P CLASS="note">NOTE: The values of the following parameters depend on the color coordinate
system selected (HLS or RGB).</P></TD>
</TR>
<TR VALIGN="TOP">
<TH COLSPAN="3">HLS Values</TH>
</TR>
<TR VALIGN="TOP">
<TD>Px</TD>
<TD>0 to 360 degrees</TD>
<TD>Hue angle</TD>
</TR>
<TR VALIGN="TOP">
<TD>Py</TD>
<TD>0 to 100 percent</TD>
<TD>Lightness</TD>
</TR>
<TR VALIGN="TOP">
<TD>Pz</TD>
<TD>0 to 100 percent</TD>
<TD>Saturation</TD>
</TR>
<TR VALIGN="TOP">
<TH COLSPAN="3">RGB Values</TH>
</TR>
<TR VALIGN="TOP">
<TD>Px</TD>
<TD>0 to 100 percent</TD>
<TD>Red intensity</TD>
</TR>
<TR VALIGN="TOP">
<TD>Py</TD>
<TD>0 to 100 percent</TD>
<TD>Green intensity</TD>
</TR>
<TR VALIGN="TOP">
<TD>Pz</TD>
<TD>0 to 100 percent</TD>
<TD>Blue intensity</TD>
</TR>
<TR VALIGN="TOP">
<TD COLSPAN="3"><P CLASS="note">NOTE: See the "<A HREF="chapter2.html#S2.4">Output Mapping</A>" section in <A HREF="chapter2.html">Chapter 2</A> for a discussion of
shade and color programming.</P></TD>
</TR>
</TBODY>
</TABLE>
<H3 ID="S14.3.4">Graphics Carriage Return ($)</H3>
<P>The $ (2/4) character indicates the end of the sixel line. The active position
returns to the left page border of the same sixel line. You can use this character
to overprint lines.</P>
<H3 ID="S14.3.5">Graphics New Line (-)</H3>
<P>The - (2/13) character indicates the end of a sixel line. The active position
moves to the left margin of the next sixel line.</P>
<H3 ID="S14.3.6">Parameter Separator (;)</H3>
<P>The ; (3/11) character separates numeric parameters in a device control string.
If there is no number before the separator, the terminal assumes that parameter
is 0. If there is a number after the separator, the terminal assumes that
parameter is 0.</P>
<H2 ID="S14.4">Sixel Scrolling Mode</H2>
<P>You can set the sixel scrolling mode by using the <B>Sixel Scrolling</B> feature in the
Graphics Set-Up screen. You can also select this mode by using the sixel
display mode (DECSDM) control function.</P>
<H3 ID="S14.4.1">Sixel Scrolling Enabled</H3>
<P>When sixel display mode is enabled, the sixel active position begins at the
upper-left corner of the ANSI text active position. Scrolling occurs when the
sixel active position reaches the bottom margin of the graphics page. When
sixel mode is exited, the text cursor is set to the current sixel cursor position.</P>
<P>The VT300 sends a sixel next line (-) character following a sixel dump. The top
line of the sixel image may scroll off the screen
if (1) your application returns the sixel dump to the terminal, or (2) you perform
a sixel dump to a video terminal connected to the VT300 printer port.</P>
<P CLASS="note">NOTE: You can prevent the sixel image from scrolling off the screen by disabling
the sixel scrolling feature.</P>
<H3 ID="S14.4.2">Sixel Scrolling Disabled</H3>
<P>When sixel scrolling is disabled, the sixel active position begins at the upper-left
corner of the active graphics page. The terminal ignores any commands
that attempt to advance the active position below the bottom margin of the
graphics page. When sixel mode is exited, the text cursor does not change from
the position it was in when sixel mode was entered.</P>
<H3 ID="S14.4.3">Sixel Display Mode Control Function</H3>
<P>You can set the sixel scrolling mode by using the sixel display mode
(DECSDM) control function.</P>
<P>When sixel display mode is set, the <B>Sixel Scrolling</B> feature is enabled. When
sixel display mode is reset, the <B>Sixel Scrolling</B> feature is disabled.</P>
<P>To set DECSDM, the control function is.</P>
<DIV CLASS="example"><TABLE CLASS="codeseq">
<TBODY>
<TR>
<TH>CSI</TH>
<TH>?</TH>
<TH>8</TH>
<TH>0</TH>
<TH>h</TH>
</TR>
<TR>
<TD>9/11</TD>
<TD>3/15</TD>
<TD>3/8</TD>
<TD>3/0</TD>
<TD>6/8</TD>
</TR>
</TBODY>
</TABLE></DIV>
<P>To reset DECSDM, the control function is.</P>
<DIV CLASS="example"><TABLE CLASS="codeseq">
<TBODY>
<TR>
<TH>CSI</TH>
<TH>?</TH>
<TH>8</TH>
<TH>0</TH>
<TH>l</TH>
</TR>
<TR>
<TD>9/11</TD>
<TD>3/15</TD>
<TD>3/8</TD>
<TD>3/0</TD>
<TD>6/12</TD>
</TR>
</TBODY>
</TABLE></DIV>
<DIV CLASS="navbar"><HR>
<TABLE WIDTH="100%">
<COL SPAN="3" WIDTH="33%">
<TBODY>
<TR>
<TD ALIGN="LEFT"><A HREF="chapter13.html">Chapter 13</A></TD>
<TD ALIGN="CENTER"><A HREF="contents.html">Contents</A></TD>
<TD ALIGN="RIGHT"><A HREF="chapter15.html">Chapter 15</A></TD>
</TR>
</TBODY>
</TABLE>
<DIV CLASS="navbot">http://vt100.net/docs/vt3xx-gp/chapter14.html</DIV></DIV>
</BODY>
</HTML>
